package com.bestcem.xm.user.util.convert;

import com.bestcem.xm.user.controller.vo.user.UserSmtpVO;
import com.bestcem.xm.user.controller.vo.user.request.UserSmtpUpdateVO;
import com.bestcem.xm.user.entity.mysql.UserSmtp;
import com.bestcem.xm.user.entity.pojo.UserSmtpDO;
import com.bestcem.xm.user.service.dto.user.UserSmtpDTO;
import com.bestcem.xm.user.util.business.mapstract.TransformStrategy;
import com.bestcem.xm.user.util.business.mapstract.TransformStrategyConstant;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 邮箱配置转换类
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/16 11:31
 */
@Mapper(componentModel = "spring")
public interface UserSmtpConvert extends TransformStrategy {

    UserSmtpDO mysql2Do(UserSmtp userSmtp);

    List<UserSmtpDO> mysqls2Dos(List<UserSmtp> userSmtps);

    UserSmtp do2Mysql(UserSmtpDO userSmtpDO);

    List<UserSmtp> dos2Mysqls(List<UserSmtpDO> userSmtpDos);

    UserSmtpDTO do2Dto(UserSmtpDO userSmtpDO);

    List<UserSmtpDTO> dos2Dtos(List<UserSmtpDO> userSmtpDos);

    UserSmtpDO dto2Do(UserSmtpDTO userSmtpDTO);

    List<UserSmtpDO> dtos2Dos(List<UserSmtpDTO> userSmtpDTOs);

    @Mapping(source = "sslFlag", target = "sslFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    @Mapping(source = "deliverFlag", target = "deliverFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    @Mapping(source = "noticeFlag", target = "noticeFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    @Mapping(source = "systemFlag", target = "systemFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    UserSmtpDTO vo2Dto(UserSmtpVO userSmtpVO);

    @Mapping(source = "sslFlag", target = "sslFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    @Mapping(source = "deliverFlag", target = "deliverFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    @Mapping(source = "noticeFlag", target = "noticeFlag", qualifiedByName = TransformStrategyConstant.BOOLEAN_TO_INTEGER)
    UserSmtpDTO updateVoToDto(UserSmtpUpdateVO vo);
}
